package com.java.demo.model;

/**
 * @auther zhangwj
 * @date 2020/12/22 上午10:20
 */
public class FacadePattern {

    public static void main(String[] args) {
        Facade facade = new Facade(new MemoryCache());
        facade.load();
    }
}

interface IMemoryCache {
    void load();
}

class MemoryCache implements IMemoryCache {

    @Override
    public void load() {
        System.out.println("内存加载");
    }
}

class DiskCache implements IMemoryCache {

    @Override
    public void load() {
        System.out.println("本地加载");
    }
}

class NetDownLoad implements IMemoryCache {

    @Override
    public void load() {
        System.out.println("网络加载");
    }
}

class Facade {

    private IMemoryCache iMemoryCache;

    Facade(IMemoryCache iMemoryCache) {
        this.iMemoryCache = iMemoryCache;
    }

    public void load() {
        iMemoryCache.load();
    }
}